home *** CD-ROM | disk | FTP | other *** search
- /*
- * alocaltime.c
- *
- * Author: Tomi Ollila <too@cs.hut.fi>
- *
- * Copyright (c) 1994 Tomi Ollila
- * All rights reserved
- *
- * Created: Wed Feb 23 16:29:03 1994 too
- * Last modified: Thu Feb 24 10:43:47 1994 too
- *
- * HISTORY
- * $Log: $
- */
-
- #include <exec/types.h>
- #include <utility/date.h>
-
- static struct UtilityBase * UtilityBase;
-
- #include <inline/exec.h>
- #include <inline/utility.h>
-
- #include <time.h>
-
- struct tm tm = { 0 };
-
- struct tm * alocaltime(ULONG * time)
- {
- struct ClockData cd;
-
- if ((UtilityBase = (struct UtilityBase *)OpenLibrary("utility.library", 37)
- ) == NULL)
- return NULL;
-
- Amiga2Date(*time, &cd);
-
- tm.tm_sec = cd.sec;
- tm.tm_min = cd.min;
- tm.tm_hour = cd.hour;
- tm.tm_mday = cd.mday;
- tm.tm_mon = cd.month - 1;
- tm.tm_year = cd.year - 1900;
- tm.tm_wday = cd.wday;
-
- CloseLibrary((struct Library *)UtilityBase);
-
- return &tm;
- }
-